import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const module = {
  state: {
    list: {
      postion: 0,
      status: 0,
      pageNo: 0,
      reffer: 0,
    },
    arriAddr: {
      province: '',
      city: '',
      district: '',
      address: '',
      contact: '',
      contactno: ''
    },
    customer: {
      guid: '',
      name: '',
      rcamount: '',
    },
    acts: {
      'clientUpdate':  'CustomerEdit',
      'priceAdjust':  'ChangePrice',
      'dispatch':  'SellDispatch',
      'salesOut':  'OutStoreRoom',
      'pickinglistOut':  'OutStoreRm', //领料单
      'materialOut':  'OutStoreRoom', //销售订单
      'scrapOut':  'ScrapOutStoreRm', //报废单
      'transferOut':  'TransferOutStoreRm', //库房调拨出库
      'transferIn':  'TransferFeedStoreRm', //库房调拨入库
      'transAdjust':  'EditLine',
      'settleConfirm':  'SellFinalSure',
      'fareConfirm':  'ConfirmFare',
      'qacheck4sc': 'Examine',
      'approval2':  'CommonExamine', //销售订单
      'approval4': 'Examine', //报废单
      'approval5': 'Examine5', //入库申请单
      'approval6': 'Examine6', //领料单
      'approval7': 'Examine7', //库房调拨
      'approval8': 'Examine7', //库房调拨
      'approval9': 'Examine7', //库房调拨
      'approval13': 'Examine13', //采收合同价格调整
      'confirm': 'ConfirmChangeContractPrice', //采收合同价格调整
      'materialIn': 'FeedStoreRm',
      'whinapply': 'ApplyStoreRm',
      'materapply': 'AddMaterialRetApply',
      'scrapapply': 'ApplyScrap',
    }
  },
  getters: {},
  mutations: {
    setPosition(state, payload){
      state.list.postion = payload
    },
    setReffer(state, payload){
      state.list.reffer = payload
    },
    setStatus(state, payload){
      state.list.status = payload
    },
    setPageNo(state, payload){
      state.list.pageNo = payload
    },
    setCustomer(state, payload){
      state.customer.guid = payload.guid;
      state.customer.name = payload.name;
      state.customer.rcamount = payload.rcamount;
    },
    setArriAddr(state, payload){
      state.arriAddr.province = payload.province;
      state.arriAddr.city = payload.city;
      state.arriAddr.district = payload.district;
      state.arriAddr.address = payload.address;
      state.arriAddr.contact = payload.contact;
      state.arriAddr.contactno = payload.contactno;
    }
  },
}


const store = new Vuex.Store(module)
export default store
